package com.iaiai.barcode;

import java.io.File;
import java.util.Hashtable;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.EncodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.Reader;
import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;

/**
 * 
 * <p>
 * Title: ImgUtil.java
 * </p>
 * <p>
 * E-Mail: 176291935@qq.com
 * </p>
 * <p>
 * QQ: 176291935
 * </p>
 * <p>
 * Http: iaiai.iteye.com
 * </p>
 * <p>
 * Create time: 2012-3-20 下午4:18:49
 * </p>
 * 
 * @author 丸子
 * @version 0.0.1
 */
public class ImgUtil {

//	/**
//	 * 读取一维和二维码
//	 * 
//	 * @param path
//	 *            文件地址，全路径
//	 * @param coding
//	 *            文字编码
//	 * @return
//	 */
//	public static String read() {
//		try {
//			Reader reader = new MultiFormatReader();
//			File file = new File(path);
//			BufferedImage image;
//
//			image = ImageIO.read(file);
//			if (image == null) {
//				return null;
//			}
//			LuminanceSource source = new BufferedImageLuminanceSource(image);
//			BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
//			Result result;
//			Hashtable hints = new Hashtable();
//			hints.put(DecodeHintType.CHARACTER_SET, coding);
//			// 解码设置编码方式为：utf-8
//			result = new MultiFormatReader().decode(bitmap, hints);
//			String resultStr = result.getText();
//			return resultStr;
//
//		} catch (Exception ex) {
//			return null;
//		}
//	}

}
